package com.star.uc.api;

import com.star.common.core.contract.R;
import com.star.uc.biz.EmailBizService;
import com.star.uc.contract.dto.request.EmailSendRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邮件控制器
 *
 * @author zhouhengzhe
 * @version 1.0
 * @date 2023/10/19 18:05
 */
@RestController
@RequestMapping("/user/email")
@RequiredArgsConstructor
@Tag(name = "EmailController", description = "邮件")
public class EmailController {

    private final EmailBizService emailBizService;

    @Operation(summary = "发送邮件")
    @PostMapping("/sendEmail")
    public R<String> sendEmail(@RequestBody @Validated EmailSendRequest emailSendRequest) {
        emailBizService.sendEmail(emailSendRequest);
        return R.ok();
    }
}
